/**
 * This program is free software but WITHOUT ANY WARRANTY OR CONDITIONS OF ANY KIND.
 *
 * Copyright (C) 2008-2013 www.pretty-tools.com
 */

wsshWebProfileSerializer.profileExists = function(profile)
{
    if (!profile)
        return false;

    if (!yrprxUtil.isString(profile))
        return true;

    if (!profile.length)
        return false;

    if (profile.indexOf(this.getProfileDirectory()) == 0)
        return !!localStorage.getItem(profile);

    return true;
}

wsshWebProfileSerializer.removeProfile = function(profile)
{
    if (profile && profile.indexOf(this.getProfileDirectory()) == 0)
        localStorage.removeItem(profile);
}

wsshWebProfileSerializer.getProfileDirectory = function()
{
    return "localStorage:";
}

wsshWebProfileSerializer.getProfile = function(profileName)
{
    return this.getProfileDirectory() + profileName;
}
